# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-smart-open
pkgname=('python2-smart-open' 'python-smart-open')
_pkgname=smart_open
pkgver=7.3.0.post1
pkgrel=1
pkgdesc='Utils for streaming large files (S3, HDFS, gzip, bz2...).'
arch=('any')
url='https://pypi.org/project/smart-open/#files'
license=('MIT')
makedepends=('python2-setuptools' 'python-setuptools')
options=(!emptydirs)
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/smart_open-$pkgver.tar.gz")
sha512sums=('c7580a85d972e5a0d8aa3148d5cdcc95a90237a82ab81c076b37e7c933b787398a353975fe8c0ecbec8faffa16175b07050a60b5d874f08e80baf128e4d915cb')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-smart-open() {
  depends=('python2' 'python2-boto' 'python2-requests' 'python2-boto3')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

package_python-smart-open() {
  depends=('python' 'python-boto' 'python-requests' 'python-boto3')

  cd "$_pkgname-$pkgver"

  python setup.py install --root="$pkgdir" --prefix=/usr -O1 --skip-build
}

